package org.lds.hotkey.console.business.rule.converter;

import org.lds.hotkey.console.business.rule.entity.Rule;
import org.lds.hotkey.console.business.rule.model.request.RuleBaseListRequest;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;


@Component
public class RuleBaseListRequestToEntityConverter implements Converter<RuleBaseListRequest, Rule> {

    @Override
    public Rule convert(RuleBaseListRequest source) {
        return Rule.builder()
                .id(source.getId())
                .appId(source.getAppId())
                .key(source.getKey())
                .prefix(source.getPrefix())
                .interval(source.getInterval())
                .threshold(source.getThreshold())
                .duration(source.getDuration())
                .desc(source.getDesc())
                .createTime(source.getCreateTime())
                .updateTime(source.getUpdateTime())
                .build();
    }

}


